package com.shopmall.common.rabbitmq;

import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class DirectConfig {
    @Bean
    public RabbitTemplate rabbitTemplate(CachingConnectionFactory factory){
        RabbitTemplate rabbitTemplate = new RabbitTemplate(factory);
        return rabbitTemplate;
    }


    @Bean
    public Queue MyDirectQueue(){
        return new Queue("76-queues",true);
    }

    @Bean
    public TopicExchange myDirectExchange(){
        return new TopicExchange("76-exchanges",true,false);
    }

//    @Bean
//    public Binding bindingDirect(){
//        return BindingBuilder.bind(MyDirectQueue()).to(myDirectExchange()).with("routingKey");
//    }

}
